#ifndef _CAN_TASK_H_
#define _CAN_TASK_H_


#include "init.h"

#define CAN_BUS1_MOTOR1_FEEDBACK_MSG_ID           0x201
#define CAN_BUS1_MOTOR2_FEEDBACK_MSG_ID           0x202 
#define CAN_BUS1_MOTOR3_FEEDBACK_MSG_ID           0x203
#define CAN_BUS1_MOTOR4_FEEDBACK_MSG_ID           0x204

#define CAN_BUS1_MOTOR5_FEEDBACK_MSG_ID           0x205
#define CAN_BUS1_MOTOR6_FEEDBACK_MSG_ID           0x206

#define CAN_BUS1_MOTOR7_FEEDBACK_MSG_ID           0x207
#define CAN_BUS1_CURRENT_FEEDBACK_MSG_ID          0x300
#define CAN_BUS1_Judge_FEEDBACK_MSG_ID            0x301
#define CAN_BUS1_CHASSIS_FEEDBACK_MSG_ID					0x302
#define CAN_BUS1_Control_FEEDBACK_MSG_ID   		  	0x303

#define CAN_BUS1_Y																0x350
#define CAN_BUS1_Z																0x351

#define CAN_BUS2_FRICTION1_FEEDBACK_MSG_ID        0x203
#define CAN_BUS2_FRICTION2_FEEDBACK_MSG_ID        0x202
#define CAN_BUS2_MOTOR7_FEEDBACK_MSG_ID           0x201

//#define MPU_6500_recive_ID     		                  0x401
#define MPU_6500_recive_ID1     		                0x401
#define MPU_6500_recive_ID2     		                0x400

typedef union 
{
	CanRxMsg CanRxMessage;
	CanTxMsg CanTxMessage;
	uint8_t Message[sizeof(CanTxMsg)];
} CanMessageUnion;


void Can1Tx_task(void *pvParameters);
void Can1Rx_task(void *pvParameters);
void Can2Tx_task(void *pvParameters);
void Can2Rx_task(void *pvParameters);
void CanReceiveMsgProcess(CanRxMsg * msg);
void CanReceiveMsgIO(CanRxMsg * msg);
void Set_FRICTION_Speed(CAN_TypeDef *CANx, int16_t Motor1_Pwm, int16_t Motor2_Pwm, int16_t Motor3_Pwm, int16_t Motor4_Pwm);

#endif

